package com.yixun.qfbao.hander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.yixun.qfbao.api.service.PremisesApiService;
import com.yixun.qfbao.apidto.GetPremisesDetailForV10ResDto;
import com.yixun.qfbao.apidto.v10dto.EstateDetailVo;
import com.yixun.qfbao.constants.OpenApiConstant;
import com.yixun.qfbao.vo.GetPremisesDetailForV10ReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * @Description 获取楼盘信息
 * @Date 2018/1/10
 * @Author sangtao
 * @Computer Administrator
 */
@Service("getPremisesDetailForV10Hander")
public class GetPremisesDetailForV10Hander {
	private static final Logger logger = LoggerFactory.getLogger(GetPremisesDetailForV10Hander.class);
	@Autowired
	private PremisesApiService premisesService;

	public EstateDetailVo hander(GetPremisesDetailForV10ReqVo reqVo) {
		EstateDetailVo resDTO = new EstateDetailVo();
		try {
			Assert.notNull(reqVo.getParams().getPremisesId(), "楼盘ID为空");
			GetPremisesDetailForV10ResDto data = premisesService.getPremisesDetailForV10(reqVo.getParams());
			resDTO.setData(data);
			resDTO.setResponseCode(ResultEnum.SUCCESS.getNo());
		} catch (Exception e) {
			logger.error("get premises detail for v10 hander error: {}", e);
			resDTO.setResponseCode(OpenApiConstant.RC_EXCEPTION_ERROR.getResponseCode());
			resDTO.setResponseMessage(e.getMessage());
			logger.error(e.getMessage());
		}
		return resDTO;

	}
}
